﻿using QRCodeBluetooth.BUS;
using QRCodeBluetooth.DAL;
using QRCodeBluetooth.Models;
using Quartz;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;

namespace QRCodeBluetooth.JobWork
{
    public class DeviceStateJob : IJob
    {
        public async Task Execute(IJobExecutionContext context)
        {
            AppDAL appDAL = new AppDAL();
            RecordBUS recordBUS = new RecordBUS();
            List<AppAuditRecord> appAuditRecords = appDAL.QuerySyncAuditRecord();
            if (appAuditRecords != null && appAuditRecords.Count > 0)
            {
                foreach (var item in appAuditRecords)
                {
                    recordBUS.PushAuditInfo(item, item.id);
                }
            }
        }
    }
}
